﻿using System.Web.Mvc;
using System.Web.Routing;

namespace OTE.Web.Infrastructure
{
    public class RouteRegistrar
    {
        public static void RegisterRoutesTo(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.ico(/.*)?" });

            //routes.MapRoute(
            //    "CategoryIndex", // Route name
            //    "Admin/{controller}/{action}/{id}", // URL with parameters
            //    new { controller = "Category", action = "Index", id = UrlParameter.Optional },  // Parameter defaults
            //    new[] { "OTE.Web.Mvc.Controllers" });

            routes.MapRoute(
                "AdminDefault", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { area = "Admin", controller = "Category", action = "Index" },  // Parameter defaults
                null,
                new[] { "OTE.Web.Mvc.Controllers" })
            .DataTokens.Add("area", "Admin");

            routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Test", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );
        }
    }
}